#pragma once
#ifndef _G_DEVICE_H_
#define _G_DEVICE_H_

#include "GTypes.h"

namespace GEngine
{
	// Device types
	#define G_DT_OTHER		0
	#define G_DT_GRAPHIC	1 << 0
	#define G_DT_SOUND		1 << 1
	#define G_DT_NETWORK	1 << 2
	#define G_DT_MOUSE		1 << 3
	#define G_DT_KEYBOARD	1 << 4
	#define G_DT_GAMEPAD	1 << 5
	#define G_DT_JOYSTICK	1 << 6
	#define G_DT_TOUCH		1 << 7
	#define G_DT_SENSOR		1 << 8

	class GModule;

	class GDevice
	{
	protected:
		bool				Enabled;	//! Convert to atomic
		bool				Connected;	//! Convert to atomic
		
		void*				DeviceHandle;
		GModule*			OwnerModule;

							GDevice(GModule* Owner, void* Handle);
		virtual				~GDevice();

		void				SetConnected(bool Value);

	public:
		void				SetEnabled(bool Value);
		bool				GetEnabled() const;

		bool				GetConnected() const;

		void*				GetDeviceHandle() const;
		GModule*			GetOwnerModule() const;

		virtual GUInt32		GetType() const;
		virtual const char* GetName() const;

		virtual void		Reset();
		virtual bool		Update();

		bool				operator==(const GDevice& Other) const;
	};

}

#endif